package com.big.tree.controller;

import com.big.tree.service.singleton.HungrySingleton;
import com.big.tree.service.singleton.InnerClassSingleton;
import com.big.tree.service.singleton.LazySingleton;
import org.springframework.web.bind.annotation.RestController;

/**
 * 单例模式
 * @author big tree
 */
@RestController
public class SingletonController {

    public static void main(String[] args) {
        System.out.println(HungrySingleton.getInstance());
        System.out.println(HungrySingleton.getInstance());

        System.out.println(InnerClassSingleton.getInstance());
        System.out.println(InnerClassSingleton.getInstance());

        System.out.println(LazySingleton.getInstance());
        System.out.println(LazySingleton.getInstance());
    }

}
